import os
import os.path
import shutil

folder_capacity = 5


def copy_files(src_dir, dest_dir):
    count = 0
    current_folder = ''

    for item in os.listdir(src_dir):
        abs_item = os.path.join(src_dir, item)
        if os.path.isfile(abs_item):
            count += 1
            if count % folder_capacity == 1:
                current_folder = os.path.join(dest_dir, str(count / folder_capacity))
                os.mkdir(current_folder)

            shutil.move(abs_item, os.path.join(current_folder, item))
            # open(os.path.join(current_folder, item), 'wb').write(open(abs_item, 'rb').read())


copy_files(r'D:\\mock-jsons-a', r'D:\\mock-jsons-b')
